package com.shanzhi.dify.utils;

import com.shanzhi.connection.common.ConnectionUtils;
import com.shanzhi.connection.common.HttpRequestType;

import java.util.Map;

public class DifyCommonUtils {

    public static String sendDify(String jsonStr, String apiKey, String fastGptApiUrl, HttpRequestType httpRequestType, Map<String, Object> params) {
        return ConnectionUtils
                .sendInternal(jsonStr, fastGptApiUrl, headers -> headers.put("Authorization", "Bearer " + apiKey), httpRequestType, params, null);
    }


    public static String sendDifyForPost(String jsonStr, String apiKey, String fastGptApiUrl) {
        return sendDify(jsonStr, apiKey, fastGptApiUrl, HttpRequestType.POST, null);
    }

}
